home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 14 / Mac Magazin and MacEasy Magazine CD - Issue 14.iso / Wissenschaft & Technik / Tools Plus 2.6.1 Evaluation Kit / Tools Plus 2.6.1 / User Manual / 14-System Polling (2 of 4) < prev    next >
INI File  |  1994-09-17  |  30KB  |  456 lines

  1. [Display using Monaco 9]
  2.  
  3.  
  4. Event Modifiers
  5. ```````````````
  6.   Tools Plus’s event modifier field provides information identical to that obtained directly from the Macintosh’s Event Manager.  To reiterate, the Modifiers field of the event record contains information about the position of the Caps Lock, Shift, Option, Command and Control keys at the time of the event, as well as the position of the mouse button.  This can be used, for example, to detect if the Command key was down when a key was typed (i.e. a Command-key sequence).  In effect, your application could respond to command key sequences that are not menu equivalents by using this method.  Your application could also place special significance on Option-Clicks.  The most common use, however, is Shift-Tab that indicates that the user wants to tab to the previous field.
  7.  
  8.   In the Macintosh’s Event Manager, the Modifiers field of the event record is an integer.  Several of the bits indicate the state of the various modifiers, as detailed in Inside Macintosh Vol 1 and Vol 5.  Tools Plus goes a step further and automatically decodes individual modifiers in the field.  This is handled through a union in C, and a variant record in Pascal.
  9.  
  10.  
  11.  
  12.  
  13.  
  14. Event Modifiers Using C
  15. ```````````````````````
  16.   When programming in C, Tools Plus’s Modifiers structure is a union that lets you access both the integer obtained from the Macintosh’s Event Manager, as well as the individual flags (bits) within the integer.  Tools Plus’s Modifiers structure looks like this:
  17.  
  18.   union TPModifiersRec {             /*This variable record contains  */
  19.                                      /*  an event's "modifiers" in 2  */
  20.                                      /*  formats…                     */
  21.                                      /*  • Macintosh Event:           */
  22.     short Num;                       /*      integer (bit operations  */
  23.                                      /*      required)                */
  24.                                      /*  • Modifier integer parsed    */
  25.     struct {                         /*    into components:           */
  26.       unsigned short bit15 :1;       /* (reserved bit)                */
  27.       unsigned short bit14 :1;       /* (reserved bit)                */
  28.       unsigned short bit13 :1;       /* (reserved bit)                */
  29.       unsigned short ControlKey :1;  /* Control key was down at event */
  30.       unsigned short OptionKey :1;   /* Option key was down at event  */
  31.       unsigned short CapsLock :1;    /* Caps Lock was down at event   */
  32.       unsigned short ShiftKey :1;    /* Shift key was down at event   */
  33.       unsigned short CmdKey :1;      /* Command key was down at event */
  34.       unsigned short MouseUp :1;     /* Mouse button was UP at event  */
  35.       unsigned short bit6 :1;        /* (reserved bit)                */
  36.       unsigned short bit5 :1;        /* (reserved bit)                */
  37.       unsigned short bit4 :1;        /* (reserved bit)                */
  38.       unsigned short bit3 :1;        /* (reserved bit)                */
  39.       unsigned short bit2 :1;        /* (reserved bit)                */
  40.       unsigned short bit1 :1;        /* (reserved bit)                */
  41.       unsigned short bit0 :1;        /* (reserved bit)                */
  42.     } Bits;                          /*                               */
  43.   };
  44.   typedef union TPModifiersRec TPModifiersRec;
  45.  
  46.  
  47.   Whenever you access any of the individual modifier flags, you reference the “bits” part of the structure.  For example, if you want to check if the Command key was down and the Option key was up when a key was typed, you can use an expression such as this:
  48.  
  49.   if ((Poll.Modifiers.Bits.CmdKey) && (!Poll.Modifiers.Bits.OptionKey))
  50.  
  51.   In contrast, the Modifiers field provided by the Macintosh’s Event Manager requires bitwise “And” operations to determine if a bit is set or not, thereby resulting in source code that looks more cryptic.  The following line duplicates the previous example’s functionality using bitwise “And” operations instead of the available bits:
  52.  
  53.  if ((Poll.Modifiers.Num & cmdKey) && !(Poll.Modifiers.Num & optionKey))
  54.  
  55.   When you are working with the Modifiers structure, you may perform operations exclusively on the integer variant of the structure, on the bits variant, or if you choose, you can mix and match as needed.  Several constants representing the “bit-equivalents” for the various flags contained in the Modifiers integer are available as follows:
  56.  
  57.                             /*Modifier masks                        */
  58.  #define btnState   0x0080  /*set to 1 if mouse button is up        */
  59.  #define cmdKey     0x0100  /*set to 1 if Command key is down       */
  60.  #define shiftKey   0x0200  /*set to 1 if Shift key is down         */
  61.  #define alphaLock  0x0400  /*set to 1 if the Caps Lock key is down */
  62.  #define optionKey  0x0800  /*set to 1 if the option key is down    */
  63.  #define controlKey 0x1000  /*set to 1 if the control key is down   */
  64.  
  65.  
  66.  
  67.  
  68.  
  69. Event Modifiers Using Pascal
  70. ````````````````````````````
  71. When programming in Pascal, Tools Plus’s Modifiers structure is a variant record that lets you access both the integer obtained from the Macintosh’s Event Manager, as well as the individual flags (bits) within the integer.  Tools Plus’s Modifiers record looks like this:
  72.  
  73. {= Polling record's "event modifiers" info}
  74.   TPModifiersRec = packed record       {This variable record contains  }
  75.                                        {  an event's "modifiers" in 2  }
  76.     case integer of                    {  formats…                     }
  77.       0: (                             {  • Macintosh Event:           }
  78.         Num: integer                   {      integer (bit operations  }
  79.       );                               {      required)                }
  80.       1: (                             {  • Modifier integer parsed    }
  81.                                        {    into components:           }
  82.         bit15, bit14, bit13: boolean;  { (reserved bits)               }
  83.         ControlKey: boolean;           { Control key was down at event }
  84.         OptionKey: boolean;            { Option key was down at event  }
  85.         CapsLock: boolean;             { Caps Lock was down at event   }
  86.         ShiftKey: boolean;             { Shift key was down at event   }
  87.         CmdKey: boolean;               { Command key was down at event }
  88.         MouseUp: boolean;              { Mouse button was UP at event  }
  89.         bit6, bit5, bit4, bit3, bit2,  { (reserved bits)               }
  90.         bit1,bit0: boolean;            {                               }
  91.       );                               {                               }
  92.     end;
  93.  
  94.  
  95.   You use each field in the record as an individual modifier variable.  For example, if you want to check if the Command key was down and the Option key was up when a key was typed, you can use an expression such as this:
  96.  
  97.      if Poll.Modifiers.CmdKey and not Poll.Modifiers.OptionKey then
  98.  
  99.   In contrast, the Modifiers field provided by the Macintosh’s Event Manager requires bitwise “And” operations to determine if a bit is set or not, thereby resulting in source code that looks more cryptic.  The following line duplicates the previous example’s functionality using bitwise “And” operations instead of the available bits:
  100.  
  101.     if (BitAnd(Poll.Modifiers.Num,cmdKey) <> 0) and
  102.                       BitAnd(Poll.Modifiers.Num,optionKey) = 0) then
  103.  
  104.   When you are working with the Modifiers record, you may perform operations exclusively on the integer variant of the record, on the bits variant, or if you choose, you can mix and match as needed.  Several constants representing the “bit-equivalents” for the various flags contained in the Modifiers integer are available as follows:
  105.  
  106. CONST                        {Modifier masks                        }
  107.           btnState  =$0080;  {set to 1 if mouse button is up        }
  108.           cmdKey    =$0100;  {set to 1 if Command key is down       }
  109.           shiftKey  =$0200;  {set to 1 if Shift key is down         }
  110.           alphaLock =$0400;  {set to 1 if the Caps Lock key is down }
  111.           optionKey =$0800;  {set to 1 if the option key is down    }
  112.           controlKey=$1000;  {set to 1 if the control key is down   }
  113.  
  114. ------------------------------------------------------------------------
  115.  
  116. PollSystem
  117. ``````````
  118.   Determine if an event occurred, and obtain that event.  PollSystem also keeps Tools Plus’s automatic processes running.
  119.  
  120.    pascal Boolean PollSystem (TPPollRecord *Poll);
  121.  
  122.    function PollSystem(var Poll:TPPollRecord): BOOLEAN;
  123.  
  124.   The Poll record contains all the information about an event.
  125.  
  126.   The function’s value returns true if an event was obtained, and false if an event was not obtained.  When PollSystem returns false, it is called a “null” event, or in Tools Plus terminology, a doNothing event.
  127.  
  128.   PollSystem calls the Macintosh Event Manager’s WaitNextEvent function (or GetNextEvent function) which performs all necessary task switching and background processing control.  Desk Accessories’ get their events, and other applications that are also running under MultiFinder or System 7 get some processing time.
  129.  
  130.   If your application does “background processing,” that is, it performs an on-going process while it is waiting for events, it should perform “one cycle” of its background process each time it receives a doNothing event (when PollSystem returns false).  A single cycle of your application’s background process should take no longer than 1/60 of a second.  See the SetNullTime routine to set the interval at which your application receives doNothing events.
  131.  
  132.   PollSystem should be called as often as possible (at least sixty times per second) to keep desk accessories, automatic processes, and other applications running under MultiFinder or System 7 running smoothly.  It is important that your application does not do a lot of processing between calls to PollSystem or it will be a “CPU hog” and make other applications run sluggishly or in spurts and jumps.
  133.  
  134. Also see:  SetNullTime.
  135.  
  136. Note: Your application should call PollSystem as often as possible (at
  137.       least 60 times per second) to allow other applications adequate
  138.       processing time.
  139.  
  140. Warning: Do not call PollSystem from within a BeginUpdateScreen /
  141.          EndUpdateScreen structure.
  142.  
  143.  
  144.  
  145.  
  146.  
  147. Tools Plus Event Codes
  148. ``````````````````````
  149.   Each event reported by PollSystem is identified by the first field of the polling record, Poll.What.  The Poll.What field contains an event code that tells your application what to do with the event record’s information.  Constants are used to identify event codes as follows:
  150.  
  151.   CONST                   {Tools Plus event codes                 }
  152.     doNothing     =  0;   {no event                               }
  153.     doChgWindow   =  1;   {user clicked in an inactive window     }
  154.     doRefresh     =  2;   {a window has to be refreshed           }
  155.     doGoAway      =  3;   {the Go-Away box was clicked            }
  156.     doButton      =  4;   {button was clicked                     }
  157.     doMenu        =  5;   {menu was selected                      }
  158.     doKeyDown     =  6;   {a keyboard key was pressed             }
  159.     doAutoKey     =  7;   {a keyboard key is auto-repeating       }
  160.     doKeyUp       =  8;   {a keyboard key was released            }
  161.     doClickField  =  9;   {mouse clicked in inactive editing field}
  162.     doScrollBar   = 10;   {mouse clicked in a scroll bar          }
  163.     doListBox     = 11;   {some sort of List Box activity         }
  164.     doClick       = 12;   {mouse click/drag [1..3]                }
  165.     doPopUpMenu   = 13;   {pop-up menu was selected               }
  166.     doPictButton  = 14;   {picture button activity                }
  167.     doClickControl=101;   {mouse clicked in a custom control      }
  168.     doManualEvent =102;   {manually processed events              }
  169.     doMoveWindow  =103;   {a window was moved by user             }
  170.     doGrowWindow  =104;   {a window was “grown” by user           }
  171.     doClickDesk   =105;   {mouse clicked in the desk top          }
  172.     doZoomWindow  =106;   {zoom box was clicked by user           }
  173.     doSuspend     =107;   {appl. suspended (in background)        }
  174.     doResume      =108;   {appl. resumed (now active appl.)       }
  175.     doChgInField  =109;   {contents of active field was changed   }
  176.     doPreRefresh  =110;   {a window may be refreshed (before Tools}
  177.                           {   Plus objects are drawn)             }
  178.  
  179.   Event codes over 100 will likely be ignored by most applications.  All events are detailed later, telling you how to respond to the event and which fields in the event record contain valid information that is related to the event.
  180.  
  181.  
  182.  
  183.  
  184.  
  185. What Does PollSystem Do?
  186. ````````````````````````
  187.   On the surface, it appears that PollSystem is just a fancy way to get an event from the Toolbox Event Manager.  Quite to the contrary, PollSystem does a lot of work for you.
  188.  
  189.   The biggest service that PollSystem performs is to keep Tools Plus’s automatic processes running smoothly.  To do this, you must understand the difference between an internally processed event, and an externally processed event.
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Internally Processed Events
  196. ```````````````````````````
  197.   An internal event is something that can be processed by Tools Plus without the knowledge or assistance of your application.  Hence the term internal means internal to Tools Plus.  The internal processing of events is how PollSystem drives its automatic tasks.
  198.  
  199.   An example of an internally processed event is a key-down event from the Toolbox Event Manager.  If the active window belongs to your application and it has an active editing field, the user’s key-strokes are automatically applied to the active field thereby affecting the text in the editing field.  Since the key-down event is processed internally, it is not reported to your application.
  200.  
  201.  
  202.  
  203.  
  204.  
  205. Externally Processed Events
  206. ```````````````````````````
  207.   Whenever PollSystem encounters an event it cannot process internally, it reports the event to your application.  An example of this is when the user clicks the close box in the active window.  Your application may want to ask the user if he wants to save the changes before closing the document.  Therefore, PollSystem only reports a request to close a window, and does not actually close it.
  208.  
  209.   Some events may be ignored by your application.  One of these events tells your application that the user dragged a window.  Your application may be interested in a window’s co-ordinates at any given time, in which case this event would be crucial.  In most cases, applications don’t care if the window is dragged, and always ignore that event.
  210.  
  211.  
  212.  
  213.  
  214.  
  215. Inside PollSystem
  216. `````````````````
  217.   Inside PollSystem describes the inner workings of the PollSystem routine.  Those programmers who are curious about this aspect, or those that want to know how Toolbox Events are translated into Tools Plus events may find this passage interesting.
  218.  
  219.   Every time your application calls PollSystem, several things happen automatically:
  220.  
  221.    (1) Desk accessories and background processes are given some processing time.
  222.  
  223.    (2) The active desk accessory (if there is one) gets any events it requires.
  224.  
  225.    (3) The insertion point is kept blinking in the active editing field (if there is one).
  226.  
  227.    (4) Task switching occurs to give other applications some processing time (when using MultiFinder or System 7).
  228.  
  229.    (5) The event queue is checked for an event.  If any events exist, the first one is removed from the queue.  If the event can be processed internally by Tools Plus, it is and this step is repeated.
  230.  
  231.    (6) If an event is obtained that can not be processed internally by Tools Plus, then Tools Plus’s event record is populated with all the required information for that event in a format that is readily usable by your application.
  232.  
  233.    (7) The cursor’s position is checked and its shape is changed if required.
  234.  
  235.    (8) PollSystem returns to your application with an event, or a “no event” (false) status.
  236.  
  237.  
  238.  
  239.  
  240.  
  241. Translating Toolbox events to Tools Plus events
  242. ```````````````````````````````````````````````
  243.   Step 3 looks pretty simple when it is summarized in a couple lines, however, the recognition and processing of internal events is quite an extensive duty for Tools Plus.  The table below describes this formidable task by listing the Macintosh’s Toolbox Event Manager’s event, the internal processes that follow, and the event that finally reaches your application.  Remember that some Toolbox events are processed internally and never reach your application, and some events that reach your program can be ignored.
  244.  
  245.  
  246.  
  247. ============+=========================================+===============
  248. Toolbox’s   | Conditions and                          |  PollSystem’s
  249. Event       | Tools Plus’s Internal Processing        |      Event
  250. ============+=========================================+===============
  251. nullEvent   | none                                    | doNothing
  252. ------------+-----------------------------------------+---------------
  253. mouseDown   | If the watch cursor is displayed then   |
  254.             | the event is ignored (clicks in push    |
  255.             | buttons are optionally exempted)        |
  256.             |-----------------------------------------+---------------
  257.             | Outside of a modal window (beep)        |
  258.             |-----------------------------------------+---------------
  259.             | In an inactive window that belongs to   | doChgWindow
  260.             | your application                        |
  261.             |-----------------------------------------+---------------
  262.             | In a floating palette that is not the   | doPreRefresh
  263.             | front most palette, and is partially    | doRefresh
  264.             | obscured by another palette.  After     |
  265.             | refreshing the window, the mouse-down   |
  266.             | event is processed.                     |
  267.             |-----------------------------------------+---------------
  268.             | In a floating palette’s title bar       |
  269.             |-----------------------------------------+---------------
  270.             | In an inactive window that belongs to   | doSuspend
  271.             | another application or desk accessory   |
  272.             |-----------------------------------------+---------------
  273.             | In Apple menu, except for “About…” item |
  274.             | (selected item is opened or activated)  |
  275.             |-----------------------------------------+---------------
  276.             | In Apple menu’s “About…” item           | doMenu
  277.             |-----------------------------------------+---------------
  278.             | Edit menu’s Undo/Redo, Cut, Paste, or   | doChgInField
  279.             | Clear item is selected for an active    |
  280.             | editing field in your application.      |
  281.             | Operation is done automatically.  Your  |
  282.             | application is informed of the change   |
  283.             |-----------------------------------------+---------------
  284.             | Edit menu’s Copy item is selected for   |
  285.             | an active editing field in your         |
  286.             | application (operation is done          |
  287.             | automatically)                          |
  288.             |-----------------------------------------+---------------
  289.             | Edit menu’s Undo, Cut, Copy, Paste, or  |
  290.             | Clear item is selected for a desk       |
  291.             | accessory (operation is done            |
  292.             | automatically)                          |
  293.             |-----------------------------------------+---------------
  294.             | In other (pull-down or hierarchical)    | doMenu
  295.             | menu selection                          |
  296.             |-----------------------------------------+---------------
  297.             | In a pop-up menu                        | doPopUpMenu
  298.             |-----------------------------------------+---------------
  299.             | In an active desk accessory or other    |
  300.             | application (clicking, dragging, or     |
  301.             | closing, etc.)                          |
  302.             |-----------------------------------------+---------------
  303.             | Selecting or deselecting lines in a     | doListBox
  304.             | list box.                               |
  305.             |-----------------------------------------+---------------
  306.             | Button in the active window (only if    | doButton
  307.             | mouse was released inside the button’s  |
  308.             | area)                                   |
  309.             |-----------------------------------------+---------------
  310.             | Picture button in the active window:    | doPictButton
  311.             | buttons with the “repeating events”     |
  312.             | option turned on produce events while   |
  313.             | the picture button is held down, as long|
  314.             | as the button does not reach the end of |
  315.             | its range.  Those without the “repeating|
  316.             | events” option produce an event only if |
  317.             | mouse was released inside the button’s  |
  318.             | area.                                   |
  319.             |-----------------------------------------+---------------
  320.             | Scroll bar in the active window (while  | doScrollBar
  321.             | in up arrow, down arrow, Page up region,|
  322.             | or Page Down region, or if thumb was    |
  323.             | moved)                                  |
  324.             |-----------------------------------------+---------------
  325.             | Active editing field, when setting a    |
  326.             | new insertion point or selection range  |
  327.             | (Edit menu’s items are enabled/disabled |
  328.             | according to the insertion point or     |
  329.             | selection)                              |
  330.             |-----------------------------------------+---------------
  331.             | Inactive editing field                  | doClickField
  332.             |-----------------------------------------+---------------
  333.             | Single-click, double-click, triple-     | doClick
  334.             | click, and/or dragging                  |
  335.             |-----------------------------------------+---------------
  336.             | Active window is dragged by user        | doMoveWindow
  337.             |-----------------------------------------+---------------
  338.             | Active window’s size is changed by      | doGrowWindow
  339.             | using the size box                      |
  340.             |-----------------------------------------+---------------
  341.             | Active window’s close box was clicked   | doGoAway
  342.             |-----------------------------------------+---------------
  343.             | Active window’s “zoom box” was clicked  | doZoomWindow
  344.             |-----------------------------------------+---------------
  345.             | Custom control                          | doClickControl
  346.             |-----------------------------------------+---------------
  347.             | On the desk top                         | doClickDesk
  348. ------------+-----------------------------------------+---------------
  349. mouseUp     | none                                    |
  350. ------------+-----------------------------------------+---------------
  351. keyDown     | If the watch cursor is displayed then   |
  352. autoKey     | the event is ignored (except for        |
  353.             | Command-.)                              |
  354.             |-----------------------------------------+---------------
  355.             | Command key invoking Edit menu’s        | doChgInField
  356.             | Undo/Redo, Cut, or Paste item in an     |
  357.             | active field in your application.       |
  358.             | Operation is done automatically.  Your  |
  359.             | application is informed of the change.  |
  360.             |-----------------------------------------+---------------
  361.             | Command key invoking Edit menu’s Copy   |
  362.             | item is selected for an active editing  |
  363.             | field in your application (operation is |
  364.             | done automatically)                     |
  365.             |-----------------------------------------+---------------
  366.             | Command key invoking Edit menu’s Undo,  |
  367.             | Cut, Copy, or Paste item in an active   |
  368.             | desk accessory under Finder (the editing|
  369.             | operation is done automatically)        |
  370.             |-----------------------------------------+---------------
  371.             | Command key invoking a menu             | doMenu
  372.             |-----------------------------------------+---------------
  373.             | Command key NOT invoking a menu         | doKeyDown or
  374.             |                                         | doAutoKey
  375.             |-----------------------------------------+---------------
  376.             | Enter or Return key invoking a default  | doButton
  377.             | push-button                             |
  378.             |-----------------------------------------+---------------
  379.             | Active editing field processing keys    |
  380.             | (Edit menu’s items are enabled/disabled |
  381.             | according to the selection in the       |
  382.             | editing field.  Undo item is changed    |
  383.             | according to field’s contents, such as  |
  384.             | “Undo Typing”)                          |
  385.             |-----------------------------------------+---------------
  386.             | Other key strokes                       | doKeyDown or
  387.             |                                         | doAutoKey
  388. ------------+-----------------------------------------+---------------
  389. keyUp       | If the watch cursor is displayed then   |
  390.             | the event is ignored                    |
  391.             |-----------------------------------------+---------------
  392.             | Active editing field ignores key up     |
  393.             | events                                  |
  394.             |-----------------------------------------+---------------
  395.             | Other key-ups, providing that           | doKeyUp
  396.             | SetEventMask has not masked out key up  |
  397.             | events                                  |
  398. ------------+-----------------------------------------+---------------
  399. updateEvt   | A doPreRefresh event is reported first. | doPreRefresh
  400.             | The next time PollSystem is called,     | doRefresh
  401.             | buttons, picture buttons, scroll bars,  |
  402.             | custom controls, editing fields, list   |
  403.             | boxes and pop-up menus are automatically|
  404.             | redrawn (refreshed) and a doRefresh     |
  405.             | event is reported. This occurs whenever |
  406.             | a partially obscured window becomes     |
  407.             | uncovered.                              |
  408. ------------+-----------------------------------------+---------------
  409. activateEvt | When a window is deactivated, the       |
  410.             | following happens automatically:        |
  411.             | [1] text in the active editing field is |
  412.             | deselected and the insertion point is   |
  413.             | removed, [2] list box lines are         |
  414.             | deselected, [3] scroll bars are hidden, |
  415.             | [4] buttons and picture buttons are     |
  416.             | disabled, [5] pop-up menus are disabled,|
  417.             | and [6] if the window has a “grow box,” |
  418.             | it is hidden.  When the window is       |
  419.             | activated again, all objects return to  |
  420.             | their normal state..                    |
  421. ------------+-----------------------------------------+---------------
  422. diskEvt     | no internal processing                  | doManualEvent
  423. networkEvt  |                                         |
  424. driverEvt   |                                         |
  425. app1Evt     |                                         |
  426. app2Evt     |                                         |
  427. app3Evt     |                                         |
  428. kHighLevel- |                                         |
  429.   Evt       |                                         |
  430. ------------+-----------------------------------------+---------------
  431. app4Evt     | If your application’s SIZE resource is  | doManualEvent
  432. osEvt       | set to not respond to Suspend/Resume    |
  433.             | events, then no internal processing     |
  434.             | occurs.                                 |
  435.             |-----------------------------------------+---------------
  436.             | If your application’s SIZE resource is  | doSuspend or
  437.             | set to respond to Suspend/Resume events,| doResume
  438.             | then these event are reported to your   |
  439.             | application.  In System 7, the osEvt    |
  440.             | representing the “mouse moved” event.   |
  441.             |-----------------------------------------+---------------
  442.             | In System 7 the osEvt also carries the  |
  443.             | “mouse moved” status, thereby becoming a|
  444.             | “mouse moved event.”  Tools Plus uses   |
  445.             | these events to automatically change the|
  446.             | cursor’s shape.                         |
  447. ----------------------------------------------------------------------
  448.  
  449.  
  450.  
  451. Responding to Events
  452. ````````````````````
  453.   When PollSystem returns with a value of false, it indicates that no event has occurred.  This is commonly called a “null event” or a doNothing event in Tools Plus.  Usually, your application won’t do anything other than idle in the main event loop.  Applications that do on-going processing should do their work only when they receive a null event.
  454.  
  455.   PollSystem returns with a value of true when an event is available.  The first field in the polling record is “what,” which tells your application what type of event has occurred.  The following section of this chapter describes how your application should respond to each event.  It also details any programming considerations that should be taken into account when responding to such an event.
  456.